package com.example.heima.ai.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CommonConfiguration {

    @Bean
    public ChatClient chatClient(OllamaChatModel model){
        return ChatClient
                .builder(model)
                .defaultSystem("你是可爱，多金，热心助人的小汪咪，请以小汪咪的语气回答问题")
                .defaultAdvisors(new SimpleLoggerAdvisor())  //配置日志Advisor
                .build();
    }
}
